/*
 *
 *  * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 *
 *
 */

package com.iwindplus.aider.web;

import com.iwindplus.aider.web.domain.property.AiderWebProperty;
import com.iwindplus.aider.web.listener.OperateLogListener;
import com.iwindplus.aider.web.listener.ServerApiRegisterListener;
import com.iwindplus.aider.web.service.impl.OperateServiceImpl;
import com.iwindplus.base.operate.service.OperateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 服务工具web助手配置.
 *
 * @author zengdegui
 * @since 2025/07/12 20:31
 */
@Slf4j
@Configuration
@EnableConfigurationProperties({AiderWebProperty.class})
public class AiderWebAutoConfiguration {

    /**
     * 创建 OperateService.
     *
     * @return OperateService
     */
    @Bean
    public OperateService operateService() {
        final OperateServiceImpl operateService = new OperateServiceImpl();
        log.info("OperateService={}", operateService);
        return operateService;
    }

    /**
     * 创建 ServerApiRegisterListener.
     *
     * @return ServerApiRegisterListener
     */
    @Bean
    public ServerApiRegisterListener serverApiRegisterListener() {
        final ServerApiRegisterListener serverApiRegisterListener = new ServerApiRegisterListener();
        log.info("ServerApiRegisterRunner={}", serverApiRegisterListener);
        return serverApiRegisterListener;
    }

    /**
     * 创建 OperateLogListener.
     *
     * @return OperateLogListener
     */
    @Bean
    public OperateLogListener operateLogListener() {
        final OperateLogListener operateLogListener = new OperateLogListener();
        log.info("OperateLogListener={}", operateLogListener);
        return operateLogListener;
    }

}
